package cn.com.ccxe.dao.parser;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.com.ccxe.core.entity.Website;

public class WebsiteParser implements ResultSetParser<Website> {
	public List<Website> parse(ResultSet rs) throws SQLException {
		List<Website> keywordList = new ArrayList<Website>();
		while (rs.next()) {
			keywordList.add(parseWebsite(rs));
		}
		return keywordList;
	}

	public Website parseObject(ResultSet rs) throws SQLException {
		return parseWebsite(rs);
	}
	
	private Website parseWebsite(ResultSet rs) throws SQLException {
		Website module = new Website();
		module.setId(rs.getInt("moduleId"));
		module.setParentId(rs.getInt("parentId"));
		module.setDiscription(rs.getString("description"));
		module.setName(rs.getString("moduleName"));
		module.setPath(rs.getString("modulePath"));
		module.setIsList(rs.getShort("isList"));
		module.setIsMonitor(rs.getShort("isMonitor"));
		return module;
	}
}